using Spine.Unity;
using System;
using UnityEngine;

namespace PKGames
{
	public class SpineSimoutaneousAnimationController : MonoBehaviour
	{
		[Serializable]
		private class SimoutaneousAnimationController
		{
			[SpineAnimation("", "", true, false)]
			public string animationName;

			public bool isLoop;
		}

		[SerializeField]
		private SkeletonAnimation _skeletonAnimation;

		[SerializeField]
		private SkeletonGraphic _skeletonGraphic;

		[SerializeField]
		private SimoutaneousAnimationController[] _idles;

		private void Start()
		{
			for (int i = 0; i < _idles.Length; i++)
			{
				if (_skeletonAnimation != null)
				{
					_skeletonAnimation.state.SetAnimation(i, _idles[i].animationName, _idles[i].isLoop);
				}
				else if (_skeletonGraphic != null)
				{
					_skeletonGraphic.AnimationState.SetAnimation(i, _idles[i].animationName, _idles[i].isLoop);
				}
			}
		}
	}
}
